# coding: utf-8
from datetime import datetime
from pathlib import Path

from ._models import SettingModel
from .tools import mkdir, touch

ProjectPath = Path(__file__).absolute().parent.parent

new_time = datetime.now()
day_time = new_time.strftime("%Y%m%d")
second_time = new_time.strftime('%Y%m%d%H%M%S')

pytest_config = SettingModel(
    setting_path=ProjectPath / 'settings.json'
).load()

# 创建测试报告目录
report_dir = Path(pytest_config.report_setting.report_dir) / f'report-{second_time}'
cache_json_path = report_dir / 'cache.json'
report_json = report_dir / 'JSON'
report_html = report_dir / "HTML"
mkdir(report_dir, report_json, report_html)
touch(cache_json_path)
